package com.yiji.fintech.musfinance.common.strategy.base;

import com.google.common.collect.Maps;
import com.yiji.fintech.musfinance.center.base.result.ResultFacade;
import com.yiji.fintech.musfinance.common.domain.base.BaseDomain;
import com.yiji.fintech.musfinance.common.service.OpratorService;
import com.yiji.fintech.musfinance.entity.AbstractTransaction;

import java.util.List;
import java.util.Map;

/**
 * Created by ouwen@yiji.com} on 2017/9/28.
 */
public abstract class AbstractUniqueStrategy extends OpratorService implements UniqueBaseStrategy{
    /**
     * 执行钩子
     * @param datas
     * @param domain
     * @param result
     */
    public abstract void process(List<AbstractTransaction> datas, BaseDomain domain, ResultFacade result);
    @Override
    public void doExcute(BaseDomain domain, ResultFacade result) {
        initDbService(domain);
        Map<String,Object> params = Maps.newHashMap();
        params.put("EQ_bizOrderNo",domain.getBizOrderNo());
        Map<String, Boolean> sortMap = Maps.newHashMap();
        List<AbstractTransaction> datas = service.query(params,sortMap);
        process(datas,domain,result);
    }
}
